<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8"/>
    <title>修改</title>
    <link href="__STATIC__/component/pear/css/pear.css" rel="stylesheet"/>
    {include file='public/head.html'}
</head>
<body class="childrenBody {:dialog_css()}">
<form class="layui-form" action="{:url('edit')}" method="post">
    <input type="hidden" name="id" value="{$vo.id}">
    <div class="layui-form-item">
        <label class="layui-form-label layui-form-item-required">父级</label>
        <div class="layui-input-block">
            {:form_select('pid', widget('menu_dir')->get(), $vo['pid'])}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label layui-form-item-required">图标</label>
        <div class="layui-input-block">
            <input type="text" name="icon" id="iconPicker" value="{$vo.icon}" lay-filter="iconPicker">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label layui-form-item-required">名称</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="required" placeholder="中文菜单名称" value="{$vo.title}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">权限</label>
        <div class="layui-input-block">
            <input type="text" name="auth" placeholder="权限：控制器/方法" value="{$vo.auth}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">链接</label>
        <div class="layui-input-block">
            <input type="text" name="href" placeholder="链接：控制器/方法?参数=值" value="{$vo.href}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">打开方式</label>
        <div class="layui-input-block">
            {:form_select('target', '_iframe=_iframe|_blank=_blank', $vo['target'])}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label layui-form-item-required">类型</label>
        <div class="layui-input-block">
            {:form_radio('type', '目录|菜单', $vo['type'])}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">禁删</label>
        <div class="layui-input-block">
            <input type="hidden" name="is_sys" value="0">
            <input type="checkbox" name="is_sys" value="1" lay-skin="switch" lay-text="是|否" {if $vo['is_sys']:} checked="checked"{/if}>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label layui-form-item-required">排序</label>
        <div class="layui-input-block">
            <input type="number" name="sort" value="{$vo.sort}" min="0" step="10" lay-affix="number" placeholder="数字排序值" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="save">
                <i class="layui-icon layui-icon-ok"></i>
                修改
            </button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script src="__STATIC__/component/layui/layui.js"></script>
<script src="__STATIC__/component/pear/pear.js"></script>
<script>
    layui.use(['form', 'iconPicker', 'aphp'], function () {
        let form = layui.form;
        let iconPicker = layui.iconPicker;
        let aphp = layui.aphp;

        iconPicker.render({
            elem: '#iconPicker',
            type: 'fontClass',
            search: true,
            page: true,
            limit: 16,
            click: function (data) {
                //console.log(data);
            },
            success: function (d) {
                //console.log(d);
            }
        });

        form.on('submit(save)', function (data) {
            aphp.request.postForm(data, 0, function () {
                parent.layer.close(parent.layer.getFrameIndex(window.name));
                top.location.reload();
            });
            return false;
        });

    });
</script>
</body>
</html>